Term Project - Milestone II
CS211 Fall 2000 Accelerated Stream

Graph Construction

Due Thursday, Nov 2, 2000
(at start of 10:10am class)

The second project milestone is a working implementation of a significant chunk of the map framework. At a minimum, you need to write both the general-purpose directed-graph data structure and the code that constructs the directed-graph representation of the street map.

In addition, the second milestone has a small amount of ancillary code that allows us to observe your implementation in action; specifically, we ask you to print the adjacency lists of all of the nodes of the street-map graph that you construct.

If you have your GUI code operational by then (not required at this date), you may avoid the ancillary code by submitting screenshots of one configuration.  Of course, you'd need to submit your GUI code too.

Details

Details of the ancillary code (option 1)

The main method for the second milestone uses two command-line arguments: the number of "vertical" (i.e., north-south) streets on the map and the number of "horizontal" (i.e., east-west) streets on the map.  The main method constructs the directed-graph representation of a street map with the specified dimensions and then prints the corresponding adjacency lists...
  class MilestoneII {
    public static void main(String[] args) {
      if (args.length != 2) {
        System.out.println("Need two command-line arguments.");
        System.out.println("In CodeWarrior, select 'Java Application Settings...'"
                         + " in the Edit menu.");
        System.out.println("Place your argument in the 'Parameters' box.");

        System.exit(-1);
      }

      int nVertical   = Integer.parseInt(args[0]);
      int nHorizontal = Integer.parseInt(args[1]);

      // construct the directed graph representation of a street map
      // with nVertical north-south streets and nHorizontal east-west
      // streets (probably by calling a street-map-construction method
      // that's been defined in another class).

      // print the adjacency lists of the nodes in the constructed graph.
      // (formatting details are given below.)

      // ...you don't need to worry about handling improper command-lines
      // [negative dimensions, etc.].
    }
  }
In order to have a human-readable names for the nodes, it is necessary to assign a unique string identifier to each node [e.g., "T16" for the sixteenth street segment tile (in order of construction, say) and "I3" for the third intersection]. Once you've done this, printing the adjacency lists is quite simple... For each node in the directed graph, print the node's ID followed by the ID's of the nodes that are adjacent to it, in the following format:
  I3: T4 T7 T11 T14
Nodes may be listed in any order.

[Clarification: the street map is a uniform nVertical-by-nHorizontal grid, like the simple #-shaped map that is depicted in the project specification. (In that example, nVertical and nHorizontal are both 2.)  In general, there are nVertical * nHorizontal intersections, and the total number of street segments is nVertical * (nHorizontal + 1) + nHorizontal * (nVertical + 1).]

UML class diagrams

You must submit updated versions of your UML class diagrams. These diagrams should reflect your current design; in particular, they must be consistent with the Java code that you submit for this milestone. In the diagrams, please highlight the changes that have occurred since Milestone I was submitted [e.g., circle the affected area and briefly explain the modification(s)].

Also, please be sure to keep a copy of this version of the UML diagrams to submit as part of the "design record" that will accompany your finished project.

For hand-drawn diagrams, you may cut and paste material from your previous set of diagrams, as long as you do it neatly and submit a crisp photocopy of it.

Tiles per street-segment lane

For this milestone, each lane of each street segment must have exactly three (3) tiles. Thus, the total number of street segment tiles on the map is 2 * 3 * (nVertical * (nHorizontal + 1) + nHorizontal * (nVertical + 1)).

Other details

In general, your implementation must comply with the (relevant) map-related requirements that appear in the project specification. In particular, please be sure that you're in compliance with the contents of the "Directed Graph Representation" section (which can be found on the main page of the specification).

What to hand in

The second milestone will be due at the beginning of lecture on Nov 2, 2000.  In hardcopy, please submit... Electronically, via CUCOON, please submit... [You do not need to submit electronic versions of your UML diagrams.]